<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/admin/commons/taglib.jsp"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理</title>
    <script type="text/javascript">
        var type = ${tmSource.type}-1;
        $(function(){
            $("#timu").addClass("active");
            $("#timu").find("ul li").eq(type).addClass("active");
        })
    </script>
</head>
<body>

    <div class="admin">
         <form id="form" method="post" action="timu!delete.action">
            <div class="panel admin-panel">
                <div class="panel-head"><strong>试题列表</strong></div>
                <div class="padding border-bottom">
                    <input type="button" id="selectall" class="button button-small checkall"  checkfor="id" value="全选" />
                    <a href="<%=request.getContextPath() %>/admin/timu/timu!toDetail.action"><input type="button" class="button button-small border-green" value="添加试题" /></a>
                    <input type="button" onClick="submit()" class="button button-small border-yellow" value="批量删除" />

                </div>

                <table class="table table-hover">
                    <tr><th width="100">选择</th><th width="120">大题标题</th><th width="120">题目类型</th><th width="200">分类</th><th width="200">操作</th></tr>

                   <s:iterator value="pageBean.data">
                    <tr>
                        <td><input type="checkbox" class="choose" name="id" value="<s:property value="id"/>" /></td>
                        <td><s:property value="name"/></td>
                        <td><s:if test="questionType==1">听力部分</s:if><s:else>阅读部分</s:else></td>
                        <td><s:if test="type==1">首测试题</s:if><s:else>周测试题</s:else></td>
                        <td><a class="button border-blue button-little" href="timu!toDetail.action?tmSource.id=<s:property value="id"/>" >修改</a>
                            <a class="button border-red button-little" href="timu!delete.action?tmSource.id=<s:property value="id"/>"
                               onclick="{if (confirm('确认删除?')) {return true;}return false;};">删除</a></td>
                    </tr>
                    </s:iterator>
                </table>
            </div>
         </form>

        <div>
            <s:include value="/admin/commons/page.jsp"></s:include>
        </div>
    </div>

    <script type="text/javascript">
        function submit(){
            var choose= document.getElementsByClassName("choose");
            if($('#selectall').is(':checked')) {
                choose[i].checked = true;
            }else{
                choose[i].checked = false;
            }
            document.getElementBy("form").submit();
        }
    </script>
</body>
</html>
